/**
 * 
 */
package com.lehecai.core.lottery;

import com.lehecai.core.IntegerBeanLabelItem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;

/**
 * @author He Wang
 * 竞彩足球单场设置类型
 */
public class JczqDcSettingType extends IntegerBeanLabelItem {

	private static final Logger logger = LoggerFactory.getLogger(JczqDcSettingType.class.getName());

	private static final long serialVersionUID = -1L;

	private static List<JczqDcSettingType> items = new ArrayList<JczqDcSettingType>();
	private static List<JczqDcSettingType> queryItems = new ArrayList<JczqDcSettingType>();

	protected JczqDcSettingType(String name, int value, boolean queryOnly) {
		super(JczqDcSettingType.class.getName(), name, value);
		queryItems.add(this);
		if (!queryOnly) {
			items.add(this);
		}
	}

	protected JczqDcSettingType(String name, int value) {
		this(name, value, false);
	}
	
	public static JczqDcSettingType getItem(int value){
		try {
			return (JczqDcSettingType) JczqDcSettingType.getResult(JczqDcSettingType.class.getName(), value);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			return null;
		}
	}
	
	public static List<JczqDcSettingType> getItems() {
		return items;
	}

	public static List<JczqDcSettingType> getItemsForQuery() {
		return queryItems;
	}

	public static final JczqDcSettingType ALL = new JczqDcSettingType("全部", -1, true);
	public static final JczqDcSettingType MATCH_NUM = new JczqDcSettingType("场次编号", 1);
	public static final JczqDcSettingType MATCH_TYPE = new JczqDcSettingType("按赛事 ", 2);

}
